package com.sq.partner.manager.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.FacadeNewPaymentDao;
import com.sq.partner.manager.mybatis.model.FacadeNewPayment;
import com.sq.partner.manager.mybatis.model.FacadePayment;

/**
 * 集中收款平台支付Dao实现类
 * 
 * @author zhouxiuxiu
 *
 */
@Repository
public class FacadeNewPaymentDaoImpl extends BaseDaoImpl implements
        FacadeNewPaymentDao {

    /**
     * 插入支付信息
     * 
     * @param payment
     * @throws Exception
     */
    @Override
    public void saveFacadeNewPayment(FacadeNewPayment payment) throws Exception {
        this.add("insertFacadeNewPayment", payment);

    }

    /**
     * 生成支付流水号用
     * 
     * @param stagNo
     * @return
     * @throws Exception
     */
    @Override
    public String findFacadeNewPayByPayId(String payId) throws Exception {
        return (String) this.query("queryFacadeNewPayByPayId", payId);
    }

    /**
     * 取得收付款信息
     * 
     * @param map
     * @return
     * @throws Exception
     */
    @Override
    public FacadeNewPayment queryNewPayment(HashMap<String, String> map)
            throws Exception {
        return (FacadeNewPayment) this.query("queryNewPaymentInfo", map);
    }
    
    /**
     * 查询暂存单号最后一次支付记录   helina 20190313
     * 
     * @param payid
     * @return
     * @throws Exception
     */
    @Override
    public FacadeNewPayment queryFacadeNewPaymentByPayidTheLatestInsertTime(
            String payid) throws Exception {
        return (FacadeNewPayment) this.query(
                "queryFacadeNewPaymentByPayidTheLatestInsertTime", payid);
    }

    /**
     * 更新收款表
     * 
     * @param facadeNewPayment
     * @return
     * @throws Exception
     */
    @Override
    public boolean updateFacadeNewPay(FacadeNewPayment facadeNewPayment)
            throws Exception {
        return (boolean) this.update("updateFacadeNewPay", facadeNewPayment);

    }

    /**
     * 对接新支付平台缴费确认失败后查询缴费确认信息 查询新支付表 20190418 helina
     * @param map
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @Override
    public Map<String, Object> queryNewConfirmAgainMessage(Map<String,Object> map) throws Exception{
    	return (Map<String, Object>) query("queryNewConfirmAgainMessage", map);
    }
}
